package com.dundun.common.constants;

/**
 * 错误码
 *
 * @author wq
 */
public enum ErrorCode {

    /**
     * 系统异常
     */
    SUCCESS(0, "ok",true),
    PARAMS_ERROR(40000, "请求参数错误",false),
    LOGIN_ERROR(40001, "用户不存在或密码错误",false),
    NOT_LOGIN_ERROR(40100, "未登录",false),
    NO_AUTH_ERROR(40101, "无权限",false),
    AUTH_TIME_OUT_ERROR(40102, "权限过期",false),
    FORBIDDEN_ERROR(40300, "禁止访问",false),
    NOT_FOUND_ERROR(40400, "请求数据不存在",false),
    CONTAINS_ILLEGAL_CHARACTERS(40500,"包含非法字符",false),
    SYSTEM_ERROR(50000, "系统内部异常",false),
    OPERATION_ERROR(50001, "操作失败",false),
    ACCESS_LIMIT_REACHED(500504, "访问过于频繁请稍后再试",false)
    ;


    /**
     * 状态码
     */
    private int code;

    /**
     * 信息
     */
    private String message;

    /**
     * 是否成功
     */
    private boolean success;

    ErrorCode(int code, String message, boolean success) {
        this.code = code;
        this.message = message;
        this.success = success;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public boolean isSuccess() {
        return success;
    }
}
